package com.cooperate.fly.mapper;

import com.cooperate.fly.bo.Table;
import com.cooperate.fly.bo.TableWithBLOBs;
import com.cooperate.fly.datasource.SqlMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@SqlMapper
public interface TableMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(TableWithBLOBs record);

    int insertSelective(TableWithBLOBs record);

    TableWithBLOBs selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TableWithBLOBs record);

    int updateByPrimaryKeyWithBLOBs(TableWithBLOBs record);

    int updateByPrimaryKey(Table record);

    //int checkTableExist(@Param("tableName") String tableName);

    int existTable(@Param("tableName")String tableName);

    List<TableWithBLOBs> selectByCaseId(@Param("table_name") String table_name, @Param("caseId") Integer caseId);

    int insertIntoTable(@Param("table_name") String table_name, @Param("record") TableWithBLOBs record);

    int updateValue(@Param("table_name") String table_name, @Param("new_value") String new_value, @Param("fieldId") Integer fieldId, @Param("caseId") Integer caseId);

    int deleteByCaseId(@Param("table_name") String table_name, @Param("caseId") Integer caseId);

    int deleteByFieldId(@Param("table_name") String table_name, @Param("fieldId") Integer fieldId);
    int selectByFieldId(@Param("table_name") String table_name, @Param("fieldId") Integer fieldId);

    TableWithBLOBs selectByCaseIdAndFieldId(@Param("table_name") String table_name, @Param("caseId") Integer caseId, @Param("fieldId") Integer fieldId);

    int updateRemark(@Param("table_name") String table_name, @Param("new_value") String new_value, @Param("fieldId") Integer fieldId, @Param("caseId") Integer caseId);

    int updateUnit(@Param("table_name") String table_name, @Param("unit") String unit, @Param("caseId") Integer caseId, @Param("fieldId") Integer fieldId);

    int updateValueandRemark(@Param("table_name") String table_name, @Param("new_value") String new_value, @Param("new_remark") String new_remark, @Param("fieldId") Integer fieldId, @Param("caseId") Integer caseId);

}